{if isset($WEB_APP.fields)}{if count($WEB_APP.fields) > 0}{if !isset($WEB_APP.unshow_asterisk)}<div id="note">{$text.txt_fields_marked_with_an_asterisk_are_required}</div>{/if}{/if}{/if}
<form action = "{$WEB_APP.action_url}" method = POST name = "FORM" {if isset($WEB_APP.form_enctype) eq TRUE}enctype = "multipart/form-data"{/if}>
{if isset($WEB_APP.fields)}
	<table width = "100%">
        	{assign var="tmp" value="2"}
		{foreach from = $WEB_APP.fields item = field name = foreach_item}
			{if $tmp eq 2}
				{assign var="tmp" value="1"}
			{else}
				{assign var="tmp" value="2"}
			{/if}
                
                {if $field->type eq 'submit_form'}
			        </table>               
                    <div align="right"><input type = "submit" class = "submit" value = "{$submit_title}" name="{$field->name}">&nbsp;<input type = "button" class = "submit" value = "{$text.txt_help}" onclick = "window.open('{$WEB_APP.help_url}', 'help_window')"></div>

			    {assign var="show_header_footer" value="0"}
                {php} continue; {/php}
            {/if}

			{if $field->type eq "header"}
				{if !isset($show_header_footer)}</table>{/if}
				<h3>{$field->title}</h3>
				<table width = "100%">
				{assign var="tmp" value="2"}
			{else}
				<tr>
					<td width = "40%" class = "line{$tmp}">{if $field->require}<b class="r">*</b> {/if}{$field->title}:</td>
					<td width = "60%" class = "line{$tmp}">
						{if $field->type eq "info"}
							{$field->value}
						{else}
					
						{if $field->type eq "textarea"}
							<textarea name = "{$field->name}" wrap = "virtual" cols = "62" rows = "10" id = "{$field->id}">{$field->value|escape}</textarea></td>
						{else}
							{if ($field->type eq "select") or ($field->type eq "multiple_select")}
								<select name = "{$field->name}" id="{$field->name}" {if $field->type eq "multiple_select"}multiple size="8"{/if} {if isset($field->on_change)}onchange="{$field->on_change}"{/if}>
									{if isset($WEB_APP.show_empty_value) eq FALSE}<option value = "" {if $field->value eq ""}SELECTED{/if}></option>{/if}
									{assign var = "value" value = $field->option_value_field}
									{assign var = "tmptext" value = $field->option_text_field}
									{foreach from = $field->array item = item}
										{if $field->type eq "select"}<option value = "{$item[$value]|escape}" {if $field->value eq $item[$tmptext]}SELECTED{/if}>{$item[$tmptext]|escape}</option>{/if}
										{if $field->type eq "multiple_select"}<option value = "{$item[$value]|escape}" {if in_array($item[$tmptext], $field->value) }SELECTED{/if}>{$item[$tmptext]|escape}</option>{/if}
									{/foreach}
								</select>
								
								{if isset($field->on_change) && $field->show_button}&nbsp;<input type="submit" class="submit" name="select_button" value="{$text.txt_select}">{/if}
								{if $field->show_description}&nbsp;<div id="{$field->name}_description_item"></div>{/if}
							
							</td>
							{else}
								<input type = "{$field->type}" name = "{$field->name}" 
								{if $field->type eq "checkbox"}
									{if $field->value eq 1}
										CHECKED
									{else}
										UNCHECKED
									{/if}
								{else}
									value = "{$field->value|escape}"
								{/if}
								id = "{$field->id}" {if $field->type eq "file"}size="53%"{else}size = "63%"{/if}></td>
							{/if}
						{/if}
						{/if}
			
				</tr>
			{/if}
		{/foreach}
	</table>
	{/if}
	{if (!isset($show_buttons)) || (isset($show_buttons) && ($show_buttons neq 0))}
	<div align="right"><input type = "submit" class = "submit" value = "{$submit_title}" name="submit_button">&nbsp;<input type = "button" class = "submit" value = "{$text.txt_help}" onclick = "window.open('{$WEB_APP.help_url}', 'help_window')"></div>
	
</form>
{if isset($WEB_APP.scripts) && in_array('shortcuts.js', $WEB_APP.scripts)}
<script>
        {literal}
		shortcut.add("Enter",function() {
		document.FORM.submit_button.click();
		},{
		'type':'keydown',
		'propagate':true,
		'target':document
		});{/literal}
</script>
{/if}

{/if}
